package com.usian.commom.vo;

import lombok.Data;
import lombok.ToString;

/**
 * @TODO:
 * @Author:baimu
 * @Date:2024 10 28 15 13
 **/

@Data
@ToString
public class ResultCommon {

    /**
     * 1:成功
     * 0：失败
     */
    Integer code;

    /**
     * SUCCESS
     * ERROR
     */
    String message;

    /**
     * 数据
     */
    Object data;


    /**
     * static :静态方法，类名.方法名   ResultCommon.suceess
     * 非静态方法：new 类    ResultCommon rc =  new ResultCommon  rc.suceess
     * @param data
     * @return
     */
    public static ResultCommon suceess(){
        ResultCommon resultCommon = new ResultCommon();
        resultCommon.setCode(1);
        resultCommon.setMessage("SUCCESS");
        return resultCommon;
    }

    public static ResultCommon suceessData(Object data){
        ResultCommon resultCommon = new ResultCommon();
        resultCommon.setCode(1);
        resultCommon.setMessage("SUCCESS");
        resultCommon.setData(data);
        return resultCommon;
    }


    public static ResultCommon error(String message){
        ResultCommon resultCommon = new ResultCommon();
        resultCommon.setCode(0);
        resultCommon.setMessage(message);
        return resultCommon;
    }


}
